package com.chensf.studydemo.rxjava

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.chensf.studydemo.R
import io.reactivex.Observable
import io.reactivex.functions.Consumer
import io.reactivex.functions.Predicate
import kotlinx.android.synthetic.main.activity_rxjava_demo.*

class RxJavaDemoActivity : AppCompatActivity(){
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_rxjava_demo)
        button1.setOnClickListener {
            test1()
        }
    }

    private fun test1() {
        val dispose = Observable.fromIterable(listOf(1,2,3))
            .filter {
                if(it > 1){
                    return@filter true
                }
                false
            }.toList().subscribe({},{})
    }
}